package com.software.modelcenter.controller;

import com.software.modelcenter.service.ModelMineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@RestController
@RequestMapping("/unity")
public class UnityController {

    @Autowired
    private ModelMineService modelMineService;

    @PostMapping("/save")
    public String test(HttpServletRequest request, @RequestPart("image") MultipartFile image) throws IOException {

        String userId = request.getParameter("userId");
        String file = request.getParameter("file");
        System.out.println(userId);
        modelMineService.saveModelMine(userId, file, image);

        return "保存成功";
    }

}
